﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;

namespace GraphDrawer
{
    public partial class Source : UserControl
    {
        public readonly ImportNetwork import = new ImportNetwork();
        public readonly GenerateNetwork generator = new GenerateNetwork();
        public Type sourceMethod;
        public event RoutedEventHandler isSelectedSource;
        private static RoutedEventHandler popUpOk;

        public Source()
        {
            InitializeComponent();
            isSelectedSource += new RoutedEventHandler(Source_isSelectedSource); 
        }

        void Source_isSelectedSource(object sender, RoutedEventArgs e)
        {
        
        }

        public void Quest_Click(object sender, RoutedEventArgs e)
        {
			App.Current.Host.Content.IsFullScreen = false;
			
            //TODO: Diplay popup "This future is not active yet. We are still working to bring it to you as soon as possible."
        }

        public void Import_Click(object sender, RoutedEventArgs e)
        {
			App.Current.Host.Content.IsFullScreen = false;
			
            sourceMethod = import.GetType();
            popUpOk = new RoutedEventHandler(PopUp_OK);
            Menu.PopUp.OK += popUpOk;
            Menu.PopUp.AddUserControl(import);
            Menu.PopUp.Visibility = Visibility.Visible;
        }

        public void Generate_Click(object sender, RoutedEventArgs e)
        {
			App.Current.Host.Content.IsFullScreen = false;
			
            sourceMethod = generator.GetType();
            popUpOk = new RoutedEventHandler(PopUp_OK);
            Menu.PopUp.OK += popUpOk;
            Menu.PopUp.AddUserControl(generator);
            Menu.PopUp.Visibility = Visibility.Visible;
        }

        void PopUp_OK(object sender, RoutedEventArgs e)
        {
            Menu.PopUp.OK -= popUpOk;
            isSelectedSource.Invoke(sender, e);
        }
    }
}
